home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8533 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.3 KB  |  89 lines

  1. Newsgroups: comp.lang.c++
  2. Path: in1.uu.net!demos!pluscom!usenet
  3. From: sergeyp@albea.ugatu.ac.ru (Sergey Pavlov)
  4. Subject: Re: Please please help a newbie!
  5. X-Newsreader: Forte Free Agent 1.0.82
  6. Sender: usenet@news.rinet.ru (Superuser)
  7. Nntp-Posting-Host: albea.ugatu.ac.ru
  8. Organization: Albea
  9. Message-ID: <DMt4qG.DLu@news.rinet.ru>
  10. References: <4ftoe8$5a2@pacifica.access.ch>
  11. Date: Thu, 15 Feb 1996 07:58:37 GMT
  12.  
  13. tombeck@usemail.com (Thomas Beck) wrote:
  14.  
  15. >Hi there!
  16.  
  17. >It's quite embarrassing to ask those two questions, because they seem 
  18. >absolutely stupid (they probably are). Yesterday I started to learn C/C++. I 
  19. >bought a 700 pages book with a cd included that has two compilers on it). I 
  20. >fully understand the chapter about the types, but the things I program just 
  21. >can't be compiled. I extracted the following two problems:
  22.  
  23. >----------- example 1: -------------
  24. >int i;
  25. >int & a=i;
  26.  
  27. >main() {
  28. >}
  29. >--------------------------------------------
  30.  
  31. >This is not compiled, I get the following output with  Symantec C++ 6.11:
  32.  
  33. >D:\SC>sc test1.c        
  34.  
  35. >sccx test1.c
  36. >int & a=i;
  37. >    ^
  38. >test1.c(2) : Error: '=', ';' or ',' expected
  39.  
  40. >--- errorlevel 1
  41.  
  42. >The second thing that doesn't work is this:
  43.  
  44. >----------- example 2: -------------
  45. >struct abc {
  46. >  int i;
  47. >  char a;
  48. >  void f1() {
  49. >  };
  50. >};
  51.  
  52. >main() {
  53. >}
  54. >---------------------------------------------
  55.  
  56. >This isn't compiled either, here's the output:
  57.  
  58. >D:\SC>sc test2.c
  59.  
  60. >sccx test2.c
  61. >  void f1() {
  62. >            ^
  63. >test2.c(4) : Error: illegal type for 'f1' member
  64.  
  65. >--- errorlevel 1
  66.  
  67.  
  68. >Before you think I'm absolutely stupid... I used to be very good at Pascal 
  69. >(TP 6.0), and I'm also experienced in OOP under Pascal. I have no clue of 
  70. >C++, however, and I can only rely on what's written in that book. Apparently 
  71. >it doesn't tell me the truth, does it?
  72.  
  73. >Can you please help me with those two problems (referenced variable and 
  74. >function within a class), so that I can go on and learn a few more difficult 
  75. >things?
  76.  
  77. >Thanks in advance,
  78.  
  79. >Thomas Beck, tombeck@usemail.com
  80.  
  81. >=================================================================
  82. >Summer's day, as she passed away. Birds were singing in the
  83. >summer sky; then came the rain, and once again, a tear fell
  84. >from her mother's eye...
  85. >=================================================================
  86.  
  87. Probably, you use C (not C++) compiler.
  88.  
  89.